package ch.bfh.abcmmh.view.detailview.streets;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class ImagePanel extends JPanel {

  /**
	 * 
	 */
	private static final long serialVersionUID = 679498100457574458L;
private Image img;


  public ImagePanel(String img,int width,int height) {
	this(new ImageIcon(img).getImage(),width, height);

    
  }

  public ImagePanel(Image img, int width, int height) {

    this.img = img;
    Dimension size = new Dimension(width,height); //new Dimension(img.getWidth(null), img.getHeight(null));
    setPreferredSize(size);
    setMinimumSize(size);
    setMaximumSize(size);
    setSize(size);
    setLayout(null);
    this.setOpaque(true);
  }

  public void paintComponent(Graphics g) {
    g.drawImage(img, 0, 0, null);
  }

}